<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
use Illuminate\Support\Facades\Auth;

class UsersController extends Controller{
  //用户列表
  function lst(){
    $menu = getAllMenu();
    $userStatus = userStatus();
    //取到用户
    $users = DB::table('users')->get();
    return view('admin.users',compact('menu','users','userStatus'));
  }

  //封禁用户
  function userDisable($id){
    $z = DB::table('users')->where('id',$id)->update(['status'=>'2']);
    if($z){
      echo json_encode(array('status'=>1,'msg'=>'禁用成功'));
    }else{
      echo json_encode(array('status'=>0,'msg'=>'禁用失败,请检查控制器'));
    }
  }
}
